Question about copying query text from existing queries


#1

Hi,

So I was looking at the Redash Source Code, specifically in queries.py, and saw this:

def post(self, query_id):
“”"
Creates a new query, copying the query text from an existing one.
:param query_id: ID of query to fork
Responds with created :ref:query <query-response-label> object.
“”"
query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
require_access(query.data_source.groups, self.current_user, not_view_only)
forked_query = query.fork(self.current_user)
models.db.session.commit()
return QuerySerializer(forked_query, with_visualizations=True).serialize()

Would it be possible to create new queries using a different source? I am using a server with an sql query engine already connected to it but we want to integrate redash in so that those queries can then be visualized. Is there a seamless way where I could possibly create new queries from queries outside of redash?

Thanks,

Nick