Skip to content

to_sql method should accept database URI as con parameter #10664

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

Closed
s-celles opened this issue Jul 24, 2015 · 1 comment
Closed

to_sql method should accept database URI as con parameter #10664

s-celles opened this issue Jul 24, 2015 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query

Comments

@s-celles
Copy link
Contributor

Hello,

This enhancement is quite similar to #10654

to_sql method should accept database URI as con parameter

So we could do

import pandas as pd
db_uri = 'dialect+driver://username:password@host:port/database'
query = 'SELECT * FROM table'
df.to_sql("table", db_uri)

instead of :

import pandas as pd
from sqlalchemy import create_engine
db_uri = 'dialect+driver://username:password@host:port/database'
engine = create_engine(db_uri)
df.to_sql("table", engine)

Might apply to :

Blaze uses table URI like 'dialect+driver://username:password@host:port/database::table'
so passing table as parameter is not necessary, as it is contained inside (table) URI
but It may be difficult to mimic this API without breaking eggs (con should be first parameter and table should be second with a default None value)

Kind regards

@jorisvandenbossche jorisvandenbossche added Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query labels Jul 24, 2015
@jorisvandenbossche jorisvandenbossche added this to the No action milestone Jul 24, 2015
@jorisvandenbossche
Copy link
Member

This can be done together with doing this for read_sql, so closing this in favor of #10654

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

No branches or pull requests

2 participants