Comments (4)
I searched online and found the reason. http://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length
It seems that MySQL doesn't accept Text
as primary key. If we still want to use Text
as the primary key, the solution is to use VARCHAR type and place a limit of length on it.
Should dataset
add support of VARCHAR
type for MySQL?
from dataset.
in #27, String
was added as one of the primary_type in create_table
function, then it was changed to Text
.
I am wondering if we can change Text
back to String
and modify create_table
function as following,
if primary_type == 'Integer':
# col = Column(primary_id, Integer, primary_key=True, autoincrement=auto_flag)
elif primary_type == 'String':
# col = Column(primary_id, String, primary_key=True)
elif primary_type matches 'String\(\d+\)':
# col = Column(primary_id, String(length), primary_key=True)
else:
raise DatasetException("The primary_type has to be either 'Integer' or 'String'.")
Thus, we can fix this bug that cannot create table with Text
type in MySQL.
from dataset.
Do you want to make a pull request to that effect? I don't think there would be any problem with it...
from dataset.
yeah, I think we can use regex to match Integer|String(\(\d+\))?
pattern.
I will make a pull request.
from dataset.
Related Issues (20)
- `_mapping` throws exception for find query in SQLite HOT 6
- Mysql and Python 3.8 HOT 7
- "primary_increment" arg in database.get_table()
- FATAL: sorry, too many clients already HOT 1
- proposing dataset-orm as an add on
- Issue when creating id field HOT 1
- table.find() substring?
- [Q] Looking the same but for golang
- find columns whose value is/is not NULL HOT 2
- home page example fails
- enums and decimals are not supported
- inconsistent Upsert documentation HOT 3
- Increase a value without reading last value
- create_table error when source data has ID field
- SQL Alchemy links in docs broken
- CompileError at `update_many` due to column in a dataset doesn't exist in a db HOT 2
- TypeError: MetaData.__init__() got an unexpected keyword argument 'bind' under sqlalchemy 2.0 HOT 1
- Looking for help: migrating dataset to sqla 2.0.0 HOT 6
- Remove duplicates from a table
- Dataset ignore my primary key HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataset.