Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a URI attribute from created engine #77

Open
jameshgrn opened this issue Dec 16, 2020 · 6 comments
Open

Support a URI attribute from created engine #77

jameshgrn opened this issue Dec 16, 2020 · 6 comments

Comments

@jameshgrn
Copy link

Is your feature request related to a problem? Please describe.
SQL Alchemy allows users to grab the URI of the sql engine (sql_engine.url) for example. Some packages require the URI instead of an engine object.

Describe the solution you'd like
I would like the engine created to have a URI attribute that returns the string representation of the connection

Describe alternatives you've considered
No way to get past this as far as I can tell.

@koxudaxi
Copy link
Owner

@jameshgrn
Thank you for creating this issue.

I don't know the feature.
Would you please show me an example or SQL Alchemy reference document? implementation of other libraries may help us.

The engine has 'url' attribute.
What did you expect to return it?

engine = create_engine( 'mysql+pydataapi://', connect_args={ 'resource_arn': 'arn:aws:rds:us-east-1:123456789012:cluster:dummy',  'secret_arn': 'arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy', 
'database': 'test'} )
print(engine.url)
# mysql+pydataapi://

@jameshgrn
Copy link
Author

@koxudaxi thank you for the package! It's great

I'm thinking of this example

https://github.com/zzzeek/sqlalchemy/blob/a8f51f3c11f3cb2e344732cf3abb371f03ed30d8/lib/sqlalchemy/engine/base.py#L2501

where the engine class has an attribute 'url'

@koxudaxi
Copy link
Owner

@jameshgrn
Thank you for the link.

What URL should I set?
My idea is this.
{db_type}+pydataapi://{resouse_arn}/{secret_arn}/{database}

Example:
mysql+pydataapi://arn:aws:rds:us-east-1:123456789012:cluster:dummy/arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy/test

Or, Did you expect traditional DB URI?
Example:
mysql://fed_user@remote_host:9306/federated/test_table

@jameshgrn
Copy link
Author

I'm not sure, let's try the traditional DB URI?

@jameshgrn
Copy link
Author

Following up, let me try each of these out in a use case and get back to you

@koxudaxi
Copy link
Owner

@jameshgrn
I'm trying to add url attribute. But, I don't know how to set the value on the created engine.
I keep working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants