o
    QDi                     @  s   d dl mZ d dlZd dlZd dlZd dlmZ d dlZd dlm	Z	 ddl
mZ ddlmZ dd	lmZmZ dd
lmZ ejddejejejejejejejfdddZdS )    )annotationsN)List)Console   )Resource)system   )commonhelpers)consolequerynamesource	List[str]r   strtypepathdebugbooltrusted	standardsc                 C  s@  t  }|r|t_|r|t_tj| |d} | s'|s'd}tj||d tjdd|	d z:t
t| |||d}	tjdd	d
}
ttj|
j |
j}g }|	j|d}|D ]}	|tj||	|dd|d qTW n ty } ztj|||d tjddd}~ww |sd}tj||d td|	d td|  dS )z
Query data)r   z(Providing "source" or "path" is required)note   )codez[bold]Index)r   r   r   datatypeFz.db)deletesuffixr   T)resourcedatabasefastuse_fallbackr   )r   	exceptionNzNot found any tabular resourcesz[bold]Queryzsqlite3 )r   r   r   r   r
   create_sourceprint_errortyperExitruler   tempfileNamedTemporaryFileatexitregisterosremover   listextendindex_resource	Exceptionprint_exception)r   r   r   r   r   r   r   r   r   r   filer   names	resourcesr"    r6   \/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/console/commands/query.pyconsole_query   s\   


r8   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   )
__future__r   r*   r,   r(   typingr   r%   rich.consoler   r   r   r    r	   r
   r   commandr   resource_namer   r   r   r   r   r8   r6   r6   r6   r7   <module>   s(    
