Package: dconnect
dconnectPower your data connections with python and query with dconnectdconnectis a lightweight data source connector wrapper for different databases, User can also perfom queries and will get data.Available datasources campactibility:SQLite, MySQL, SQL Server, Azure SQL, PostgreSQL, Redshift, Snowflake, Clickhouse, Oracle, IBM_Db, Vertica, MongoDB, AWS S3 Bucket, GoogleSheets, Elasticsearch, Google Analytics, Neo4jInstallationInstallation from GitClone repository using below commandgitclonehttps://github.com/nit567esh/dconnect.gitGo to python package folder and use below command to install the package into library location:$cd<pkg_directory>
$python3setup.pyinstallInstallation from PypiInstall directly from Pypi using below commandpipinstalldconnector
python3-mpipinstalldconnectUsagesIn order to use the dcoonect, use below stepsDownloadcredentails.jsonfile.Configure the required connection using the credentails.json template.Store it somewhere in safe folder.Use below commands to run you dconnect>>>importdconnectasc
>>>conids=c.conids('path_of_your_saved_credentails.json')>>>print(conids)# Choose any connection id from list to validate the connection>>>con=c.connect('your_connection_id(dsidentifier key in credentails.json)')>>>df=c.runsql(con,'show tables;')Functions:List configured connection IDs>>>importdconnectasc
>>>conids=c.conids('path_of_your_saved_credentails.json')>>>print(conids)Connect using a conid>>>con=c.connect('<your_connection_id>')You can only run SQL queries incase on Relational DBs/DWs connection object.>>>df=c.runsql(con,'<Sql-Query>')Examples:1. For Relational DBs/DWs>>>con=c.connect('redshift_<host>_<database>')>>>df=c.runsql(con,'select top 10 * from edw.dim_product')Note- Same is applicalble for the following list of DBs:SQLite, MySQL, SQL Server, Azure SQL, PostgreSQL, Redshift, Snowflake, Clickhouse, Oracle, IBM_Db, Vertica2. For OthersFunctionrunsqlis only applicable to relational DBs/DWs. For other data source dconnect only allow to connect with data source and for query purpose you can ues the respective generic packages using the connection object initilized by dconnect.Google Sheet Example>>>con=c.connect('gsheet_<username>@gamil.com')# using dconnect>>>sh=con.open("<GsheetName>")# using pysgsheets>>>wks=sh.worksheet_by_title("<GsheetTab>")# using pysgsheets>>>df=wks.get_as_df()# using pysgsheetsDataSourcePythob PkgGitRepoPypiDependenciesGoogle Sheetpygsheetshttps://github.com/nithinmurali/pygsheetshttps://pygsheets.readthedocs.io/en/stable/client_secret json fileGoogle Analyticsgoogle2pandashttps://github.com/panalysis/Google2Pandashttps://pypi.org/project/Google2Pandas/client_secret json file, token fileGoogleAdsgoogleadshttps://github.com/googleads/googleads-python-libhttps://pypi.org/project/googleads/client_secret json fileAWS S3boto3https://github.com/boto/boto3https://pypi.org/project/boto3/Mongo DBpymongohttps://github.com/mher/pymongohttps://pypi.org/project/pymongo/Elasticsearchelasticsearchhttps://github.com/elastic/elasticsearchhttps://pypi.org/project/elasticsearch/Neo4jneo4jhttps://github.com/neo4jhttps://pypi.org/project/neo4j/TodosREST API, FTP, SFTP, Google Adsense/Manager/Search Console, Mixpanel, Hive, HDFC, Apache Kylin, Apache Druid and many more