Questions tagged [sqlalchemy-access]

A Microsoft Access dialect for SQLAlchemy.

As noted on the PyPI project page:

This dialect is mainly intended to offer pandas users an easy way to save a DataFrame into an Access database via to_sql.

27 questions
2
votes
1 answer

How can I write a pandas dataframe into an Access database using pyodbc?

I am using the following code to read a table from an access db as a pandas dataframe: import pyodbc import pandas as pd connStr = ( r"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};" r"DBQ=C:\Users\A\Documents\Database3.accdb;" …
user19299338
2
votes
1 answer

NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:access.pyodbc

I want to import a dataframe into a access database but I got an error NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:access.pyodbc from sqlalchemy import create_engine import urllib import pyodbc conec = (r"Driver={Microsoft Access…
2
votes
1 answer

Writing to MS-Access DB with fast_executemany does not work

i am having problems to load data into an access-database. For testing purpose i build a little convert functions which takes all data-sets from a hdf-file and writes it into the accdb. Without the @event.listens_for(engine, "before_cursor_execute")…
Jason
  • 35
  • 5
1
vote
2 answers

SQLAlchemy Error: has_table() got an unexpected keyword argument 'info_cache' encountered

I keep encountering this error upon executing df.to_sql.I want to append existing data from a csv file into a MS DB file (accdb). Can you please help me out? I cant see anywhere in the internet a solution about this error.The DB has been created…
user11956646
1
vote
1 answer

sqlalchemy-access: Table already exists

Update: I tried running the script from another computer with an earlier version of sqlalchemy-access (1.1.2 instead of 1.1.3) the script worked. When I installed 1.1.2 on the computer that gave the error, I got NoSuchModuleError: Can't load…
Nitzan
  • 33
  • 5
1
vote
1 answer

Query filter using CDate() produces inconsistent results

i try to get this Query running but it does not work like i expected. In the table is a Date Field Formatted as Text (can't change it) and i need to filter this Column. Dates looks like 11/03/2022 (d/m/Y) My Query looks like session.query(DBGEUK)\ …
Shark00n
  • 85
  • 1
  • 10
1
vote
1 answer

Pyodbc Connection to Access, creating table with Pandas to_sql(method='multi') throwing errror

I've installed sql-alchemy Access so that I'm able to use pandas and pyodbc to query my Access DB's. The issue is, it's incredibly slow because it does single row inserts. Another post suggested I use method='multi' and while it seems to work for…
Mofongo
  • 131
  • 8
1
vote
1 answer

Python: Something other than pyodbc or a workaround when importing data into Access table

I have a Python script I created which pulls data from a government website, formats the data, then dumps the data into an Access table. I'm using Sqlalchemy and pyodbc to import the data; however, if my data has an integer column at all, I get the…
Heather
  • 877
  • 1
  • 8
  • 24
1
vote
1 answer

Error using to_sql(… , method='multi') with MS Access

I am inserting data into a Microsoft Access database using the following code: test_data.to_sql('employee_table', cnxn, index=False, if_exists='append', chunksize=10, method='multi') This gives error: AttributeError: 'CompileError' object has no…
Zanam
  • 4,607
  • 13
  • 67
  • 143
1
vote
1 answer

"Not a valid password" error when reflecting an encrypted Access database

i'm beginner in sqlalchemy, i want to reflect my table in database to object, but always return invalid password, even though the password is correct. I dont understand why this happend. When i try to inspect they return my table name, so my…
AIRGG
  • 13
  • 4
1
vote
1 answer

SQLAlchemy AutoMap AttributeError (despite having primary key defined)

I am trying to reflect an existing MS Access database into a new model. To link the database to SQLAlchemy, I am using engine = create_engine("access+pyodbc://@db-dns") Since the database already exists, I am following the basic use scheme from…
1
vote
1 answer

MS Access database locked by Python

I'm writing a dataframe to an MS Access database using Python. It works, but I can't seem to close the connection (i.e. the database is locked by Python). Here's my code: # imports import urllib import pyodbc import pandas as pd from sqlalchemy…
Dread
  • 789
  • 3
  • 16
  • 31
1
vote
1 answer

exporting pandas dataframe into a access table using to_sql generate error

I am trying to use sqlalchemy-access library to insert a data frame into an access database: The code that I have is: import msaccessdb import pyodbc import pandas as pd print(pyodbc.version) db_file =…
mans
  • 17,104
  • 45
  • 172
  • 321
1
vote
1 answer

MS Access pyodbc Pandas dataframe to_sql throws Invalid Precision Value

I'm using the pandas dataframe's to_sql function to save records to MS Access 97 MDB. But I'm getting the error below: pyodbc.Error: ('HY104', '[HY104] [Microsoft][ODBC Microsoft Access Driver]Invalid precision value (98)…
Jay
  • 23
  • 4
1
vote
1 answer

SQLAlchemy - MS Access connection failure

I am trying to connect to MS Access using sql alchemy. My access is 64 bit. I have tried with both 32-bit python and 64-bit python. The results are the same. It works using pyodbc: import pyodbc from sqlalchemy import create_engine class…
Gautam Sardana
  • 311
  • 1
  • 3
  • 9
1
2